import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { BannerVo, BannerForm, BannerQuery } from './types';

//banner列表
export const getListBanner = (query: BannerQuery): AxiosPromise<BannerVo[]> => {
  return request({
    url: '/banner/list',
    method: 'get',
    params: query
  });
};

//添加banner
export const saveBanner = (data: BannerForm) =>{
  return request({
    url: '/banner/saveBanner',
    method: 'post',
    headers: {
      repeatSubmit: false
    },
    data: data
  });
};

//修改
export const updateBanner = (data: BannerForm) => {
  return request({
    url: '/banner/updateBanner',
    method: 'post',
    headers: {
      repeatSubmit: false
    },
    data: data
  });
};

//删除banner
export const removeBanner = (id: string | number | Array<string | number>) => {
  return request({
    url: '/banner/' + id,
    method: 'delete'
  });
};

//获取banner
export const getBanner = (id: string | number): AxiosPromise<BannerVo> => {
  return request({
    url: '/banner/' + id,
    method: 'get'
  });
};



